I don't understand something about KMotionCNC: with PC commands sent from the Kflop, such as changing the tool length table entry, the following code in kmotioncncdlg.cpp is run to set the command result:
int CKMotionCNCDlg::SetKFLOPCommandResult(int r)
{
CString s;
MainStatus.PC_comm[0]=0; // clear the command now that it has been executed
s.Format("SetPersistDec%d %d",PC_COMM_PERSIST,r);
if (TheFrame->KMotionDLL->WriteLine(s)) return 1;
return 0;
}
However, the caller in CKMotionCNCDlg::ServiceKFLOPCommands() often calls this with a positive error code. The code running on the kflop is something like:
int DoPC(int cmd)
{
int result;
persist.UserData[PC_COMM_PERSIST]=cmd;
do
{
WaitNextTimeSlice();
}while (result=persist.UserData[PC_COMM_PERSIST]>0);
return result;
}
which will loop forever if there is a +ve result code.